<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Student cerficate Details</f:facet>

        <s:decorate id="id" template="layout/display.xhtml">
            <ui:define name="label">Id</ui:define>
            <h:outputText value="#{studentCerficateHome.instance.id}"/>
        </s:decorate>

        <s:decorate id="receivedStatus" template="layout/display.xhtml">
            <ui:define name="label">Received status</ui:define>
            <h:outputText value="#{studentCerficateHome.instance.receivedStatus}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/StudentCerficateEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty studentCerficateFrom ? 'StudentCerficateList' : studentCerficateFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Student</h:panelGroup>
        </f:facet>
    <div class="association" id="studentParent">

        <h:outputText value="There is no student associated with this studentCerficate."
                   rendered="#{studentCerficateHome.instance.student == null}"/>

        <rich:dataTable var="_student"
                   value="#{studentCerficateHome.instance.student}"
                rendered="#{studentCerficateHome.instance.student != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="studentTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_student.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">UserAccount id</f:facet>
                <h:outputText value="#{_student.userAccount.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Course id</f:facet>
                <h:outputText value="#{_student.course.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_student.firstName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_student.lastName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Passport photo url</f:facet>
                <h:outputText value="#{_student.passportPhotoUrl}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Date of birth</f:facet>
                <h:outputText value="#{_student.dateOfBirth}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Register number</f:facet>
                <h:outputText value="#{_student.registerNumber}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Roll number</f:facet>
                <h:outputText value="#{_student.rollNumber}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewstudent"
                     value="View"
                      view="/Student.xhtml">
                    <f:param name="studentId"
                           value="#{_student.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Certificate</h:panelGroup>
        </f:facet>
    <div class="association" id="certificateParent">

        <h:outputText value="There is no certificate associated with this studentCerficate."
                   rendered="#{studentCerficateHome.instance.certificate == null}"/>

        <rich:dataTable var="_certificate"
                   value="#{studentCerficateHome.instance.certificate}"
                rendered="#{studentCerficateHome.instance.certificate != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="certificateTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_certificate.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Certificate name</f:facet>
                <h:outputText value="#{_certificate.certificateName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Description</f:facet>
                <h:outputText value="#{_certificate.description}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewcertificate"
                     value="View"
                      view="/Certificate.xhtml">
                    <f:param name="certificateId"
                           value="#{_certificate.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Student certificate locations</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="studentCertificateLocationsChildren">

        <h:outputText value="There are no studentCertificateLocations associated with this studentCerficate."
                   rendered="#{empty studentCerficateHome.studentCertificateLocations}"/>

        <rich:dataTable value="#{studentCerficateHome.studentCertificateLocations}"
                       var="_studentCertificateLocation"
                  rendered="#{not empty studentCerficateHome.studentCertificateLocations}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="studentCertificateLocationsTable">
            <rich:column sortBy="#{_studentCertificateLocation.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_studentCertificateLocation.id}"/>
            </rich:column>
            <rich:column sortBy="#{_studentCertificateLocation.locationUrl}">
                <f:facet name="header">Location url</f:facet>
                <h:outputText value="#{_studentCertificateLocation.locationUrl}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectstudentCertificateLocation"
                     value="Select"
                      view="/StudentCertificateLocation.xhtml">
                    <f:param name="studentCertificateLocationId"
                            value="#{_studentCertificateLocation.id}"/>
                    <f:param name="studentCertificateLocationFrom" value="StudentCerficate"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add studentCertificateLocation"
                view="/StudentCertificateLocationEdit.xhtml">
            <f:param name="studentCerficateId"
                    value="#{studentCerficateHome.instance.id}"/>
            <f:param name="studentCertificateLocationFrom" value="StudentCerficate"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
